home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / INTER53G.ZIP / INT2TPH.ZIP / INT2TPH.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-08-10  |  53.9 KB  |  1,420 lines

  1. { INT2Tph. Main module for the Interrupt List -> .TPH compiler.}
  2. { The software included, data formats and basic algorithms are }
  3. { copyright (C) 1996 by Slava Gostrenko. All rights reserved.  }
  4.  
  5. {$M 16384}
  6. {$IFNDEF DPMI}
  7.   ! set Target to 'Protected Mode Application'
  8. {$ENDIF}
  9.  
  10. {$X+}
  11. program
  12.   Int2TPH;
  13.  
  14. uses
  15.   Upcaser, Objects, TPH;
  16.  
  17. type
  18.   PString32 = ^TString32;
  19.   TString32 = string [32];
  20.  
  21. const
  22.   ExtendedIndex: Boolean = True;
  23.  
  24. var
  25.   FO: THelpFile;
  26.   IncompPattern: Text;
  27.   Hdrs: TStringCollection;
  28.   IntLists: array [Byte] of PTopic;
  29.   IntNames: array [Byte] of string [12];
  30.   KeyLists: TCollection;
  31.   KeyNames: TCollection;
  32.   IntList: PTopic;
  33.   IntListName: string;
  34.   Tables: PTopic;
  35.   TablesName: string;
  36.   CMOS: PTopic;
  37.   CMOSName: string;
  38.   FarCall: PTopic;
  39.   FarCallName: string;
  40.   Memory: PTopic;
  41.   MemoryName: string;
  42.   Ports: PTopic;
  43.   PortsName: string;
  44.  
  45.   IntListIndex: PTopic;
  46.   IntListIndexName: string;
  47.  
  48. const HexCh: array [0..$F] of Char = '0123456789ABCDEF';
  49. function HexWord (W: Word): string;
  50. begin
  51.   HexWord := HexCh[Hi(W) shr 4] + HexCh[Hi(W) and $F]
  52.            + HexCh[Lo(W) shr 4] + HexCh[Lo(W) and $F];
  53. end;
  54. function HexByte (B: Byte): string;
  55. begin
  56.   HexByte := HexCh[B shr 4] + HexCh[B and $F];
  57. end;
  58.  
  59. function MemInitSwapFile(FileName: PChar; FileSize: Longint): Integer; far; external 'RTM' Index 35;
  60. function MemCloseSwapFile(Delete: Integer): Integer; far; external 'RTM' Index 36;
  61.  
  62. function MakeCorrectTopicName (const TopicName: string): string;
  63. var
  64.   I: Integer;
  65.   V: Integer;
  66.   AddChar, TstTopic: string;
  67.   Rez: string;
  68. begin
  69.   Rez := TopicName;
  70.  
  71.   if Length (Rez) > 31 then
  72.     Rez [0] := #31;
  73.  
  74.   V := 0;
  75.  
  76.   if Length (Rez) = 31 then
  77.     AddChar := '   '
  78.   else
  79.   if Length (Rez) = 30 then
  80.     AddChar := '  '
  81.   else
  82.   if Length (Rez) = 29 then
  83.     AddChar := ' '
  84.   else
  85.     AddChar := '';
  86.  
  87.   TstTopic := StUpcase2 (Rez);
  88.   while Hdrs. Search (@TstTopic, I) do begin
  89.     Dec (Rez [0], Length (AddChar));
  90.     Inc (V);
  91.     if V > 99 then
  92.       WriteLn ('error 3');
  93.  
  94.     System. Str (V, AddChar);
  95.     if Length (AddChar) = 1 then
  96.       AddChar := '_0' + AddChar
  97.     else
  98.       AddChar := '_'  + AddChar;
  99.  
  100.     Rez := Rez + AddChar;
  101.     TstTopic := StUpcase2 (Rez);
  102.   end;
  103.  
  104.   Hdrs. Insert (NewStr (TstTopic));
  105.  
  106.   MakeCorrectTopicName := Rez;
  107. end;
  108.  
  109. function ProcessPattern (var Str: string; var Pos: Integer;
  110.                          Pattern: string; Keyword: string;
  111.                          Topic: PTopic; StepBack: Integer): Boolean;
  112. var I, J: Integer;
  113. begin
  114.   I := 1;
  115.   while I <= Length (Pattern) do begin
  116.     if Pattern [I] in [#3, #6] then
  117.       if Upcase [Str [Pos + I - 1]] in HexChars + ['X'] then begin
  118.         J := System. Pos (#3, Keyword);
  119.         if J > 0 then
  120.           Keyword [J] := Str [Pos + I - 1]
  121.         else
  122.           if Pattern [I] = #3 then begin
  123.             WriteLn (Str);
  124.             WriteLn ('error in keyword pattern (1) ', Pattern, ' ', Keyword);
  125.             ProcessPattern := False;
  126.             Exit;
  127.           end;
  128.       end else begin
  129.         ProcessPattern := False;
  130.         Exit;
  131.       end
  132.     else
  133.     if Pattern [I] in [#4, #7] then begin
  134.       if (  (Upcase [Str [Pos + I - 1]] in ['B', 'C', 'D'])
  135.         and (Upcase [Str [Pos + I]] in ['X', 'L', 'H']))
  136.       or (  (Upcase [Str [Pos + I - 1]] in ['S', 'D'])
  137.         and (Upcase [Str [Pos + I]] = 'I'))
  138.       or (  (Upcase [Str [Pos + I - 1]] in ['B', 'S'])
  139.         and (Upcase [Str [Pos + I]] = 'P'))
  140.       or (  (Upcase [Str [Pos + I - 1]] in ['D', 'E', 'S', 'F', 'G'])
  141.         and (Upcase [Str [Pos + I]] = 'S'))
  142.       or (  (Upcase [Str [Pos + I - 1]] = 'S')
  143.         and (Upcase [Str [Pos + I]] = 'F'))
  144.       then begin
  145.         J := System. Pos (#4, Keyword);
  146.         if J > 0 then begin
  147.           Keyword [J] := Str [Pos + I - 1];
  148.           Keyword [J + 1] := Str [Pos + I];
  149.           Inc (I);
  150.         end else
  151.           if Pattern [I] = #4 then begin
  152.             WriteLn (Str);
  153.             WriteLn ('error in keyword pattern (2) ', Pattern, ' ', Keyword);
  154.             ProcessPattern := False;
  155.             Exit;
  156.           end else
  157.             Inc (I);
  158.       end else begin
  159.         ProcessPattern := False;
  160.         Exit;
  161.       end
  162.     end else
  163.     if Pattern [I] in [#5, #8] then begin
  164.       if (  (Upcase [Str [Pos + I - 1]] in ['B', 'C', 'D'])
  165.         and (Upcase [Str [Pos + I]] in ['X', 'L', 'H']))
  166.       or (  (Upcase [Str [Pos + I - 1]] = 'S')
  167.         and (Upcase [Str [Pos + I]] = 'F'))
  168.       then begin
  169.         J := System. Pos (#5, Keyword);
  170.         if J > 0 then begin
  171.           Keyword [J] := Str [Pos + I - 1];
  172.           Keyword [J + 1] := Str [Pos + I];
  173.           Inc (I);
  174.         end else
  175.           if Pattern [I] = #5 then begin
  176.             WriteLn (Str);
  177.             WriteLn ('error in keyword pattern (3) ', Pattern, ' ', Keyword);
  178.             ProcessPattern := False;
  179.             Exit;
  180.           end else
  181.             Inc (I);
  182.       end else begin
  183.         ProcessPattern := False;
  184.         Exit;
  185.       end
  186.     end else
  187.     if ((Pattern [I] = 'X') and (Upcase [Str [Pos + I - 1]] in ['L', 'H']))
  188.     or ((Pattern [I] in ['L', 'H']) and (Upcase [Str [Pos + I - 1]] = 'X'))
  189.     then
  190.       {Ok}
  191.     else
  192.     if Pattern [I] = 'H' then begin
  193.       if Upcase [Str [Pos + I - 1]] <> 'H' then begin
  194.         Delete (Pattern, I, 1);
  195.         Dec (I);
  196.       end;
  197.     end else
  198.     if Upcase [Str [Pos + I - 1]] <> Upcase [Pattern [I]] then begin
  199.       ProcessPattern := False;
  200.       Exit;
  201.     end;
  202.  
  203.     Inc (I);
  204.   end;
  205.  
  206.   {Once user's request for pattern with helper was confirmed}
  207.   {make the pattern suitable for helper string analizis.    }
  208.   if Pattern [Length (Pattern)] = '"' then
  209.     Dec (Pattern [0]);
  210.  
  211.   if  (Pos + Length (Pattern) - 1 > Length (Str))
  212.   and (Pattern [Length (Pattern)] in ['h', 'H']) then
  213.     Dec (Pattern [0]);
  214.  
  215.   if Pos + Length (Pattern) - 1 <= Length (Str) then begin
  216.     if (System. Pos (#3, Keyword) > 0)
  217.     or (System. Pos (#4, Keyword) > 0)
  218.     or (System. Pos (#5, Keyword) > 0) then begin
  219.       WriteLn (Str);
  220.       WriteLn ('error in keyword pattern (4) ', Pattern, ' ', Keyword);
  221.     end;
  222.  
  223.     if  (Length (Keyword) < 13)
  224.     and (Pos + Length (Pattern) <= Length (Str))
  225.     and (Str [Pos + Length (Pattern)] in (['/', 'h', 'H', ':', '-'] + HexChars))
  226.     and (Pos + Length (Pattern) + 1 <= Length (Str))
  227.     and (not (Str [Pos + Length (Pattern) + 1] in ['I', 'R', 'W', '-', ' ']))
  228.     then begin
  229.       WriteLn (IncompPattern, Str);
  230.       WriteLn (IncompPattern, 'not a complete pattern ', Pattern, ' for keyword ', Keyword);
  231.     end;
  232.  
  233.     if  (Pos + Length (Pattern) <= Length (Str))
  234.     and (Str [Pos + Length (Pattern)] = '"') then begin
  235.       Keyword := Keyword + '"';
  236.       I := Pos + Length (Pattern) + 1;
  237.       while (I <= Length (Str)) and (Str [I] <> '"') do begin
  238.         Keyword := Keyword + Str [I];
  239.         Inc (I);
  240.       end;
  241.       if I <= Length (Str) then begin
  242.         Keyword := Keyword + '"';
  243.         if Copy (Keyword, 1, 4) = 'INT ' then
  244.           Delete (Keyword, 1, 4);
  245.       end else
  246.         Delete (Keyword, System.Pos ('"', Keyword), Length (Keyword));
  247.     end;
  248.  
  249.     Topic^. AddKeyword (Keyword, StepBack);
  250.     Insert (#2, Str, Pos + Length (Pattern));
  251.     Insert (#2, Str, Pos);
  252.     Inc (Pos, Length (Pattern) + 1);
  253.  
  254.     ProcessPattern := True;
  255.   end else
  256.     ProcessPattern := False;
  257. end;
  258.  
  259. function SkipPattern (var Str: string; var Pos: Integer;
  260.                       Pattern: string): Boolean;
  261. var I, J: Integer;
  262. begin
  263.   I := 1;
  264.   while I <= Length (Pattern) do begin
  265.     if Pattern [I] = #3 then
  266.       if Upcase [Str [Pos + I - 1]] in HexChars + ['X'] then begin
  267.         {Ok}
  268.       end else begin
  269.         SkipPattern := False;
  270.         Exit;
  271.       end
  272.     else
  273.     if Pattern [I] = #4 then begin
  274.       if (  (Upcase [Str [Pos + I - 1]] in ['B', 'C', 'D'])
  275.         and (Upcase [Str [Pos + I]] in ['X', 'L', 'H']))
  276.       or (  (Upcase [Str [Pos + I - 1]] in ['S', 'D'])
  277.         and (Upcase [Str [Pos + I]] = 'I'))
  278.       or (  (Upcase [Str [Pos + I - 1]] in ['B', 'S'])
  279.         and (Upcase [Str [Pos + I]] = 'P'))
  280.       or (  (Upcase [Str [Pos + I - 1]] in ['D', 'E', 'S', 'F', 'G'])
  281.         and (Upcase [Str [Pos + I]] = 'S'))
  282.       or (  (Upcase [Str [Pos + I - 1]] = 'S')
  283.         and (Upcase [Str [Pos + I]] = 'F'))
  284.       then begin
  285.         {Ok}
  286.       end else begin
  287.         SkipPattern := False;
  288.         Exit;
  289.       end
  290.     end else
  291.     if Pattern [I] = #5 then begin
  292.       if (  (Upcase [Str [Pos + I - 1]] in ['B', 'C', 'D'])
  293.         and (Upcase [Str [Pos + I]] in ['X', 'L', 'H']))
  294.       or (  (Upcase [Str [Pos + I - 1]] = 'S')
  295.         and (Upcase [Str [Pos + I]] = 'F'))
  296.       then begin
  297.         {Ok}
  298.       end else begin
  299.         SkipPattern := False;
  300.         Exit;
  301.       end
  302.     end else
  303.     if ((Pattern [I] = 'X') and (Upcase [Str [Pos + I - 1]] in ['L', 'H']))
  304.     or ((Pattern [I] in ['L', 'H']) and (Upcase [Str [Pos + I - 1]] = 'X'))
  305.     then
  306.       {Ok}
  307.     else
  308.     if Pattern [I] = 'H' then begin
  309.       if Upcase [Str [Pos + I - 1]] <> 'H' then begin
  310.         Delete (Pattern, I, 1);
  311.         Dec (I);
  312.       end;
  313.     end else
  314.     if Upcase [Str [Pos + I - 1]] <> Upcase [Pattern [I]] then begin
  315.       SkipPattern := False;
  316.       Exit;
  317.     end;
  318.  
  319.     Inc (I);
  320.   end;
  321.  
  322.   if Pos + Length (Pattern) - 1 <= Length (Str) then begin
  323.     if  (Pos + Length (Pattern) <= Length (Str))
  324.     and (Str [Pos + Length (Pattern)] in (['/', 'h', 'H', ':', '-'] + HexChars))
  325.     and (Pos + Length (Pattern) + 1 <= Length (Str))
  326.     and (not (Str [Pos + Length (Pattern) + 1] in ['I', 'R', 'W', '-', ' ']))
  327.     then begin
  328.       WriteLn (IncompPattern, Str);
  329.       WriteLn (IncompPattern, 'not a complete pattern ', Pattern);
  330.     end;
  331.  
  332.     Inc (Pos, Length (Pattern) - 1);
  333.  
  334.     SkipPattern := True;
  335.   end else
  336.     SkipPattern := False;
  337. end;
  338.  
  339. procedure AddStr2Topic (Str: string; var Topic: PTopic;
  340.                         var TopicName: string; const CurInt, CurSubF, CurCat: string;
  341.                         Indexed: Boolean);
  342. var I: Integer;
  343.     KeyCnt: Integer;
  344.     OldTopicName: string;
  345.     OldTopicCount: Word;
  346. begin
  347.   KeyCnt := 0;
  348.   for I := 1 to Length (Str) do
  349.     if Str [I] = #2 then
  350.       Inc (KeyCnt);
  351.  
  352.   I := 1;
  353.   while I <= Length (Str) do begin
  354.     if Str [I] = #2 then
  355.       Dec (KeyCnt);
  356.  
  357.     if not Odd (KeyCnt) then
  358.       if  (I + 4 <= Length (Str))
  359.       and (Str [I] = '#')
  360.       and (Str [I + 1] in ['0'..'9', 'C', 'F', 'M', 'P'])
  361.       and (Str [I + 2] in ['0'..'9'])
  362.       and (Str [I + 3] in ['0'..'9'])
  363.       and (Str [I + 4] in ['0'..'9'])
  364.       then begin
  365.         Topic^. AddKeyword (Copy (Str, I, 5), KeyCnt div 2);
  366.         Insert (#2, Str, I + 5);
  367.         Insert (#2, Str, I);
  368.         Inc (I, 6);
  369.       end else
  370.         if (I = 1)
  371.         or (not (Upcase [Str [I - 1]] in ['A'..'Z', '0'..'9'])) then
  372.           case Upcase [Str [I]] of
  373.           'I':
  374.             if ProcessPattern (Str, I, 'INT '#3#3'H/AX='#3#3#3#3'H/'#4#4'='#3#3#3#3'H',
  375.                  #3#3#3#3#3#3#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  376.  
  377.             or ProcessPattern (Str, I, 'INT 13/AX=2000H/DL=81H', '1320' + CurCat, Topic, KeyCnt div 2)
  378.             or ProcessPattern (Str, I, 'INT '#3#3'H/AX='#3#3#3#3'H/'#5#5'='#3#3'H',
  379.                  #3#3#3#3#3#3#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  380.  
  381.             or ProcessPattern (Str, I, 'INT 21/AX=4202H/CX=0/DX=0', '2142' + CurCat, Topic, KeyCnt div 2)
  382.             or ProcessPattern (Str, I, 'INT '#3#3'H/AX='#6#6#6#6'H-'#6#6#6#6'H',
  383.                  'INT '#3#3, Topic, KeyCnt div 2)
  384.             or ProcessPattern (Str, I, 'INT '#3#3'H/AX='#3#3#3#3'H',
  385.                  #3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  386.  
  387.             or ProcessPattern (Str, I, 'INT '#3#3'H/AH='#3#3#3#3'H',
  388.                  #3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  389.  
  390.             or ProcessPattern (Str, I, 'INT '#3#3'H/AH='#3#3'H/'#4#4'='#3#3#3#3'H',
  391.                  #3#3#3#3'--'#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  392.             or ProcessPattern (Str, I, 'INT '#3#3'H/AH='#3#3'H/'#5#5'='#3#3'H',
  393.                  #3#3#3#3'--'#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  394.             or ProcessPattern (Str, I, 'INT '#3#3'H/AH='#6#6'H-'#6#6'H',
  395.                  'INT '#3#3, Topic, KeyCnt div 2)
  396.             or ProcessPattern (Str, I, 'INT '#3#3'H/AH='#3#3'H',
  397.                  #3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  398.  
  399.             or ProcessPattern (Str, I, 'INT '#3#3'H/AL='#3#3'H/'#4#4'='#3#3#3#3'H',
  400.                  #3#3'--'#3#3#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  401.             or ProcessPattern (Str, I, 'INT '#3#3'H/AL='#3#3'H/'#5#5'='#3#3'H',
  402.                  #3#3'--'#3#3#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  403.             or ProcessPattern (Str, I, 'INT '#3#3'H/AL='#3#3'H',
  404.                  #3#3'--'#3#3 + CurCat, Topic, KeyCnt div 2)
  405.  
  406.             or ProcessPattern (Str, I, 'INT '#3#3'H/'#4#4'='#3#3#3#3'H',
  407.                  #3#3'----'#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  408.             or ProcessPattern (Str, I, 'INT '#3#3'H/'#5#5'='#3#3'H',
  409.                  #3#3'----'#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  410.  
  411.             or ProcessPattern (Str, I, 'INT '#3#3'H/'#3#3#3#3'H',
  412.                  #3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  413.             or ProcessPattern (Str, I, 'INT '#3#3'H/'#6#6'H-'#6#6'H',
  414.                  'INT '#3#3, Topic, KeyCnt div 2)
  415.             or ProcessPattern (Str, I, 'INT '#3#3'H/'#3#3'H',
  416.                  #3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  417.             or ProcessPattern (Str, I, 'INT '#6#6'-INT '#6#6'H',
  418.                  'TITLES', Topic, KeyCnt div 2)
  419.             or ProcessPattern (Str, I, 'INT '#6#6'-'#6#6'H',
  420.                  'TITLES', Topic, KeyCnt div 2)
  421.             or ProcessPattern (Str, I, 'INT XXH',
  422.                  'TITLES', Topic, KeyCnt div 2)
  423.             or ProcessPattern (Str, I, 'INT '#3#3'H',
  424.                  'INT '#3#3, Topic, KeyCnt div 2)
  425.             then
  426.               ;
  427.           'A':
  428.             if ProcessPattern (Str, I, 'AX='#3#3#3#3'H/'#4#4'='#3#3#3#3'H',
  429.                  CurInt + #3#3#3#3#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  430.             or ProcessPattern (Str, I, 'AX='#3#3#3#3'H/'#5#5'='#3#3'H',
  431.                  CurInt + #3#3#3#3#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  432.             or ProcessPattern (Str, I, 'AX='#6#6#6#6'H-'#6#6#6#6'H',
  433.                  'INT ' + CurInt, Topic, KeyCnt div 2)
  434.             or ProcessPattern (Str, I, 'AX='#3#3#3#3'H',
  435.                  CurInt + #3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  436.             or ProcessPattern (Str, I, 'AH='#3#3'H/AL='#3#3'H',
  437.                  CurInt + #3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  438.  
  439.             or ProcessPattern (Str, I, 'AH='#3#3'H/'#4#4'='#3#3#3#3'H',
  440.                  CurInt + #3#3'--'#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  441.             or ProcessPattern (Str, I, 'AH='#3#3'H/'#5#5'='#3#3'H',
  442.                  CurInt + #3#3'--'#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  443.             or ProcessPattern (Str, I, 'AH='#6#6'H-'#6#6'H',
  444.                  'INT ' + CurInt, Topic, KeyCnt div 2)
  445.             or ProcessPattern (Str, I, 'AH='#3#3'H',
  446.                  CurInt + #3#3 + CurCat, Topic, KeyCnt div 2)
  447.  
  448.             or ProcessPattern (Str, I, 'AL='#3#3'H/'#4#4'='#3#3#3#3'H',
  449.                  CurInt + Copy (CurSubF, 1, 2) + #3#3#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  450.             or ProcessPattern (Str, I, 'AL='#3#3'H/'#5#5'='#3#3'H',
  451.                  CurInt + Copy (CurSubF, 1, 2) + #3#3#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  452.             or ProcessPattern (Str, I, 'AL='#6#6'H/'#6#6'H',
  453.                  CurInt + Copy (CurSubF, 1, 2) + CurCat, Topic, KeyCnt div 2)
  454.             or ProcessPattern (Str, I, 'AL='#6#6'H-'#6#6'H',
  455.                  CurInt + Copy (CurSubF, 1, 2) + CurCat, Topic, KeyCnt div 2)
  456.             or ProcessPattern (Str, I, 'AL='#3#3'H',
  457.                  CurInt + Copy (CurSubF, 1, 2) + #3#3 + CurCat, Topic, KeyCnt div 2)
  458.             then
  459.               ;
  460.           'B', 'C', 'D', 'S', 'E', 'F', 'G':
  461.             if ProcessPattern (Str, I, #4#4'='#3#3#3#3'H',
  462.                  CurInt + CurSubF + #4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  463.             or SkipPattern (Str, I, 'CX=CX-1')
  464.             or ProcessPattern (Str, I, #8#8'='#6#6'H/'#6#6'H',
  465.                  CurInt + CurSubF + CurCat, Topic, KeyCnt div 2)
  466.             or ProcessPattern (Str, I, #8#8'='#6#6'H-'#6#6'H',
  467.                  CurInt + CurSubF + CurCat, Topic, KeyCnt div 2)
  468.             or ProcessPattern (Str, I, #5#5'='#3#3'H',
  469.                  CurInt + CurSubF + #5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  470.             then
  471.               {nothing}
  472.             else
  473.             if Upcase [Str [I]] = 'C' then begin
  474.               if ProcessPattern (Str, I, 'CMOS DATA',
  475.                    'CMOS', Topic, KeyCnt div 2)
  476.               or ProcessPattern (Str, I, 'CMOS 8086/88',
  477.                    'CMOS', Topic, KeyCnt div 2)
  478.               or ProcessPattern (Str, I, 'CMOS 80C86/88',
  479.                    'CMOS', Topic, KeyCnt div 2)
  480.               or ProcessPattern (Str, I, 'CMOS '#3#3#3#3'H',
  481.                    'R'#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  482.               or ProcessPattern (Str, I, 'CMOS '#3#3'H-'#3#3'H',
  483.                    'R'#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  484.               or ProcessPattern (Str, I, 'CMOS '#3#3'H',
  485.                    'R'#3#3 + CurCat, Topic, KeyCnt div 2)
  486.               or ProcessPattern (Str, I, 'CMOS',
  487.                    'CMOS', Topic, KeyCnt div 2)
  488.  
  489.               or ProcessPattern (Str, I, 'CALL XXXXH:XXXXH"',
  490.                    '@xxxxxxxx', Topic, KeyCnt div 2)
  491.               or ProcessPattern (Str, I, 'CALL XXXXH:XXXXH',
  492.                    'FAR CALLS', Topic, KeyCnt div 2)
  493.               or ProcessPattern (Str, I, 'CALL '#3#3#3#3'H:'#3#3#3#3'H',
  494.                  '@'#3#3#3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  495.               then
  496.                 ;
  497.             end;
  498.           '@':
  499.             if ProcessPattern (Str, I, '@XXXXH:XXXXH"',
  500.                  '@xxxxxxxx', Topic, KeyCnt div 2)
  501.             or ProcessPattern (Str, I, '@XXXXH:XXXXH',
  502.                  'FAR CALLS', Topic, KeyCnt div 2)
  503.             or ProcessPattern (Str, I, '@'#3#3#3#3'H:'#3#3#3#3'H',
  504.                  '@'#3#3#3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  505.             then
  506.               ;
  507.           'M':
  508.             if ProcessPattern (Str, I, 'MEM '#6#6#6#6'H:xxxxH',
  509.                  'MEMORY', Topic, KeyCnt div 2)
  510.             or ProcessPattern (Str, I, 'MEM '#3#3#3#3'H:'#3#3#3#3'H',
  511.                  'M'#3#3#3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  512.             or ProcessPattern (Str, I, 'MEM '#3#3#3#3#3#3#3#3'H',
  513.                  'M'#3#3#3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  514.             then
  515.               ;
  516.           'P':
  517.             if ProcessPattern (Str, I, 'PORT ACCESS',
  518.                  'PORTS', Topic, KeyCnt div 2)
  519.             or ProcessPattern (Str, I, 'PORT '#3#3#3#3'H-'#3#3#3#3'H',
  520.                  'P'#3#3#3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  521.             or ProcessPattern (Str, I, 'PORT '#3#3#3#3'H-'#3#3#3'H',
  522.                  'P'#3#3#3#3#3#3#3' ' + CurCat, Topic, KeyCnt div 2)
  523.             or ProcessPattern (Str, I, 'PORT '#3#3#3#3'H-????H',
  524.                  'P'#3#3#3#3'????' + CurCat, Topic, KeyCnt div 2)
  525.             or ProcessPattern (Str, I, 'PORT '#3#3#3#3'H',
  526.                  'P'#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  527.             then
  528.               ;
  529.           end;
  530.  
  531.     Inc (I);
  532.   end;
  533.  
  534.   Topic^. AddString (' ' + Str);
  535.  
  536.   if Topic^. Size > (65536 * 2) div 3 then begin
  537.     WriteLn ('topic ', TopicName, ' will be splited, index mode - ', Indexed);
  538.  
  539.     OldTopicName := TopicName;
  540.     OldTopicCount := Topic^.Count;
  541.  
  542.     TopicName := TopicName + '_';
  543.     TopicName := MakeCorrectTopicName (TopicName);
  544.  
  545.     Topic^. AddKeyword (TopicName, 0);
  546.     Topic^. AddString (' '#2'next page'#2);
  547.  
  548.     FO. IdxTbl. Insert (New (PIndexEntry, Init (
  549.       OldTopicName, '', 0, Topic, Indexed)));
  550.  
  551.     New (Topic, Init (1, 1));
  552.  
  553.     Topic^. AddKeyword (OldTopicName, 0);
  554.     Topic^. AddString (' '#2'previous page'#2);
  555.   end;
  556. end;
  557.  
  558. function ProcessInterrup (const FileName: string; const FileIsATopic: string): Boolean;
  559. type
  560.   DividerRec = record
  561.     Len: Byte;
  562.     S: array [0..7] of Char;   (* '--------' *)
  563.     Cat: Char;                 (* category *)
  564.     C: Char;                   (* '-' *)
  565.     case Integer of
  566.       0: (Int: array [0..1] of Char; (* Interrupt number, 2 hex digits *)
  567.           SubF: array [0..3] of Char;(* sub function, 4 hex digits or '-' *)
  568.           R: array [0..1] of Char;   (* Secondary Register Name, Two Letters or '--' *)
  569.           RV: array [0..3] of Char;  (* sec. reg. value, 4 hex digits or '-' *)
  570.           Rest: array [0..17] of Char;
  571.          );
  572.       1: (RSign: Char;
  573.           R1,
  574.           R2: array [0..1] of Char;
  575.          );
  576.       2: (AtSign: Char;
  577.           CallSeg,
  578.           CallOfs: array [0..3] of Char;
  579.          );
  580.       3: (MSign: Char;
  581.           MemSeg,
  582.           MemOfs: array [0..3] of Char;
  583.          );
  584.       4: (PSign: Char;
  585.           P1,
  586.           P2: array [0..3] of Char;
  587.          );
  588.   end;            (* record dividerRec *)
  589.  
  590.   T2W = record Lo, Hi: Word; end;
  591.   T22 = record Lo, Hi: array [0..1] of Char; end;
  592.  
  593. var
  594.   FI: Text;
  595.   Str, StrUp: string;
  596.   TopicName: string;
  597.  
  598.   CurCat: string [1];
  599.   CurInt: string [2];
  600.   CurSubF: string [4];
  601.  
  602.   DR: DividerRec absolute Str;
  603.  
  604. procedure ProcessHdr (Hdr: string);
  605. begin
  606.   with DR do begin
  607.     if (S <> '--------')
  608.     or (not (Cat in ['A'..'Z', 'a'..'z', '!', '*', '-']))
  609.     or (C <> '-')
  610.     or ((Cat <> '!')
  611.         and
  612.         ((not (RSign in ['R', 'r']))
  613.       or (not (R1 [0] in HexChars))
  614.       or (not (R1 [1] in HexChars))
  615.       or (  (R2 <> '--')
  616.         and ((not (R2 [0] in HexChars))
  617.           or (not (R2 [1] in HexChars)))
  618.          )
  619.         )
  620.         and
  621.         ((not (AtSign = '@'))
  622.       or (not (CallSeg [0] in HexChars + ['x']))
  623.       or (not (CallSeg [1] in HexChars + ['x']))
  624.       or (not (CallSeg [2] in HexChars + ['x']))
  625.       or (not (CallSeg [3] in HexChars + ['x']))
  626.       or (not (CallOfs [0] in HexChars + ['x']))
  627.       or (not (CallOfs [1] in HexChars + ['x']))
  628.       or (not (CallOfs [2] in HexChars + ['x']))
  629.       or (not (CallOfs [3] in HexChars + ['x']))
  630.         )
  631.         and
  632.         ((not (MSign in ['M', 'm']))
  633.       or (not (MemSeg [0] in HexChars + ['x']))
  634.       or (not (MemSeg [1] in HexChars + ['x']))
  635.       or (not (MemSeg [2] in HexChars + ['x']))
  636.       or (not (MemSeg [3] in HexChars + ['x']))
  637.       or (not (MemOfs [0] in HexChars + ['x']))
  638.       or (not (MemOfs [1] in HexChars + ['x']))
  639.       or (not (MemOfs [2] in HexChars + ['x']))
  640.       or (not (MemOfs [3] in HexChars + ['x']))
  641.         )
  642.         and
  643.         ((not (PSign in ['P', 'p']))
  644.       or (not (P1 [0] in HexChars))
  645.       or (not (P1 [1] in HexChars))
  646.       or (not (P1 [2] in HexChars))
  647.       or (not (P1 [3] in HexChars))
  648.       or (  (P2 <> '----')
  649.         and (P2 <> '????')
  650.         and ((not (P2 [0] in HexChars))
  651.           or (not (P2 [1] in HexChars))
  652.           or (not (P2 [2] in HexChars))
  653.           or (not (P2 [3] in HexChars + ['x', ' '])))
  654.          )
  655.         )
  656.         and
  657.         ((not (Int [0] in HexChars))
  658.       or (not (Int [1] in HexChars))
  659.       or (  (SubF <> '----')
  660.         and ((T22 (SubF). Lo <> '--')
  661.           or (not (SubF [2] in HexChars))
  662.           or (not (SubF [3] in HexChars)))
  663.         and ((T22 (SubF). Hi <> '--')
  664.           or (not (SubF [0] in HexChars))
  665.           or (not (SubF [1] in HexChars)))
  666.         and ((not (SubF [0] in HexChars))
  667.           or (not (SubF [1] in HexChars))
  668.           or (not (SubF [2] in HexChars))
  669.           or (not (SubF [3] in HexChars)))
  670.          )
  671.       or (  (R <> '--')
  672.         and ((R <> 'BX') or (not (RV [0] in HexChars))
  673.                          or (not (RV [1] in HexChars))
  674.                          or (not (RV [2] in HexChars))
  675.                          or (not (RV [3] in HexChars)))
  676.         and ((R <> 'CX') or (not (RV [0] in HexChars))
  677.                          or (not (RV [1] in HexChars))
  678.                          or (not (RV [2] in HexChars))
  679.                          or (not (RV [3] in HexChars)))
  680.         and ((R <> 'DX') or (not (RV [0] in HexChars))
  681.                          or (not (RV [1] in HexChars))
  682.                          or (not (RV [2] in HexChars))
  683.                          or (not (RV [3] in HexChars)))
  684.         and ((R <> 'SI') or (not (RV [0] in HexChars))
  685.                          or (not (RV [1] in HexChars))
  686.                          or (not (RV [2] in HexChars))
  687.                          or (not (RV [3] in HexChars)))
  688.         and ((R <> 'DI') or (not (RV [0] in HexChars))
  689.                          or (not (RV [1] in HexChars))
  690.                          or (not (RV [2] in HexChars))
  691.                          or (not (RV [3] in HexChars)))
  692.         and ((R <> 'SP') or (not (RV [0] in HexChars))
  693.                          or (not (RV [1] in HexChars))
  694.                          or (not (RV [2] in HexChars))
  695.                          or (not (RV [3] in HexChars)))
  696.         and ((R <> 'BP') or (not (RV [0] in HexChars))
  697.                          or (not (RV [1] in HexChars))
  698.                          or (not (RV [2] in HexChars))
  699.                          or (not (RV [3] in HexChars)))
  700.         and ((R <> 'ES') or (not (RV [0] in HexChars))
  701.                          or (not (RV [1] in HexChars))
  702.                          or (not (RV [2] in HexChars))
  703.                          or (not (RV [3] in HexChars)))
  704.         and ((R <> 'DS') or (not (RV [0] in HexChars))
  705.                          or (not (RV [1] in HexChars))
  706.                          or (not (RV [2] in HexChars))
  707.                          or (not (RV [3] in HexChars)))
  708.  
  709.         and ((R <> 'BH') or (not (RV [0] in HexChars))
  710.                          or (not (RV [1] in HexChars))
  711.                          or (T22 (RV). Hi <> '--'))
  712.         and ((R <> 'BL') or (not (RV [0] in HexChars))
  713.                          or (not (RV [1] in HexChars))
  714.                          or (T22 (RV). Hi <> '--'))
  715.         and ((R <> 'CH') or (not (RV [0] in HexChars))
  716.                          or (not (RV [1] in HexChars))
  717.                          or (T22 (RV). Hi <> '--'))
  718.         and ((R <> 'CL') or (not (RV [0] in HexChars))
  719.                          or (not (RV [1] in HexChars))
  720.                          or (T22 (RV). Hi <> '--'))
  721.         and ((R <> 'DH') or (not (RV [0] in HexChars))
  722.                          or (not (RV [1] in HexChars))
  723.                          or (T22 (RV). Hi <> '--'))
  724.         and ((R <> 'DL') or (not (RV [0] in HexChars))
  725.                          or (not (RV [1] in HexChars))
  726.                          or (T22 (RV). Hi <> '--'))
  727.  
  728.         and ((R <> 'SF') or (not (RV [0] in HexChars))
  729.                          or (not (RV [1] in HexChars))
  730.                          or (not (RV [2] in HexChars))
  731.                          or (not (RV [3] in HexChars)))
  732.         and ((R <> 'SF') or (not (RV [0] in HexChars))
  733.                          or (not (RV [1] in HexChars))
  734.                          or (T22 (RV). Hi <> '--'))
  735.          )
  736.       or (Rest <> '------------------')
  737.         )
  738.        )
  739.     then
  740.       WriteLn ('header error: ', Hdr);
  741.  
  742.     if Cat = '!' then begin
  743.       TopicName := Copy (Str, 10, Length (Str) - 9);
  744.       CurInt := '';
  745.       CurSubF := '';
  746.     end else
  747.       if RSign in ['R', 'r'] then begin
  748.         TopicName := RSign + R1 + R2;
  749.         CurInt := '';
  750.         CurSubF := '';
  751.       end else
  752.       if AtSign = '@' then begin
  753.         TopicName := AtSign + CallSeg + CallOfs;
  754.         CurInt := '';
  755.         CurSubF := '';
  756.       end else
  757.       if MSign in ['M', 'm'] then begin
  758.         TopicName := MSign + MemSeg + MemOfs;
  759.         CurInt := '';
  760.         CurSubF := '';
  761.       end else
  762.       if PSign in ['P', 'p'] then begin
  763.         TopicName := PSign + P1 + P2;
  764.         CurInt := '';
  765.         CurSubF := '';
  766.       end else begin
  767.         TopicName := Int + SubF + R + RV;
  768.         CurInt := Int;
  769.         CurSubF := SubF;
  770.       end;
  771.  
  772.     while TopicName [Length (TopicName)] = '-' do Dec (TopicName [0]);
  773.     if Length (TopicName) > 0 then
  774.       while TopicName [1] = '-' do Delete (TopicName, 1, 1)
  775.     else
  776.       TopicName := FileName;
  777.  
  778.     if not (Cat in ['!', '-']) then begin
  779.       TopicName := TopicName + Cat;
  780.       CurCat := Cat;
  781.     end else
  782.       CurCat := '';
  783.   end;
  784. end;
  785.  
  786. var
  787.   SectionStarted: Boolean;
  788.   SectionClosed: Boolean;
  789.   I, J: Integer;
  790.   Topic: PTopic;
  791.   ExtendedHeader: string;
  792.   OriginalTopicName: string;
  793.  
  794.   TblStarted: Boolean;
  795.   TblClosed: Boolean;
  796.   TblTopic: PTopic;
  797.   TblTopicName: string;
  798.  
  799.   PrevStr, SavePtr: PString;
  800.   AddNextStringToTopicAsATblRef: Boolean;
  801.  
  802.   IndexThisTopic: Boolean;
  803.  
  804. begin
  805.   Assign (FI, FileName);
  806.   {$I-}
  807.   Reset (FI);
  808.   if IOResult = 0 then begin
  809.     ProcessInterrup := True;
  810.     WriteLn ('processing ', FileName, '                                      ');
  811.  
  812.     TblStarted := False;
  813.     TblClosed := True;
  814.  
  815.     SectionStarted := False;
  816.     SectionClosed := True;
  817.  
  818.     AddNextStringToTopicAsATblRef := False;
  819.  
  820.     IndexThisTopic := True;
  821.  
  822.     if FileIsATopic <> '' then begin
  823.       TopicName := FileIsATopic;
  824.       CurCat := '';
  825.       CurInt := '';
  826.       CurSubF := '';
  827.  
  828.       New (Topic, Init (1, 1));
  829.       SectionStarted := True;
  830.       SectionClosed := False;
  831.       TopicName := MakeCorrectTopicName (TopicName);
  832.       OriginalTopicName := TopicName;
  833.       ExtendedHeader := #2 + TopicName + #2;
  834.     end;
  835.  
  836.     while not EOF (FI) do begin
  837.       ReadLn (FI, Str);
  838.  
  839.       if  (Length (Str) > 0)
  840.       and (FileIsATopic = '')
  841.       and ((Str [1] = '-') and (Pos ('--------', Str) <> 0))
  842.       and (Str <> '---------------------------------------------')
  843.       and (Str <> '------------------------------------------------------------------------------')
  844.       then begin
  845.         if not TblClosed then begin
  846.           TblTopic^.AddKeyword (OriginalTopicName, 0);
  847.           AddStr2Topic (ExtendedHeader, TblTopic, TblTopicName, CurInt, CurSubF, CurCat, False);
  848.           FO. IdxTbl. Insert (New (PIndexEntry, Init (
  849.             TblTopicName, '', 0, TblTopic, False)));
  850.           TblStarted := False;
  851.           TblClosed := True;
  852.         end;
  853.  
  854.         if not SectionClosed then begin
  855.           if Pos ('CMOS', StUpcase2 (FileName)) > 0 then begin
  856.             CMOS^.AddKeyword (OriginalTopicName, 0);
  857.             AddStr2Topic (ExtendedHeader,
  858.                           CMOS, CMOSName, CurInt, CurSubF, CurCat, True);
  859.           end else
  860.           if Pos ('FARCALL', StUpcase2 (FileName)) > 0 then begin
  861.             FarCall^.AddKeyword (OriginalTopicName, 0);
  862.             AddStr2Topic (ExtendedHeader,
  863.                           FarCall, FarCallName, CurInt, CurSubF, CurCat, True);
  864.           end else
  865.           if Pos ('MEMORY', StUpcase2 (FileName)) > 0 then begin
  866.             Memory^.AddKeyword (OriginalTopicName, 0);
  867.             AddStr2Topic (ExtendedHeader,
  868.                           Memory, MemoryName, CurInt, CurSubF, CurCat, True);
  869.           end else
  870.           if Pos ('PORTS', StUpcase2 (FileName)) > 0 then begin
  871.             Ports^.AddKeyword (OriginalTopicName, 0);
  872.             AddStr2Topic (ExtendedHeader,
  873.                           Ports, PortsName, CurInt, CurSubF, CurCat, True);
  874.           end else
  875.           if  (FileIsATopic = '')
  876.           and ((not (ExtendedHeader [2] in HexChars))
  877.             or (not (ExtendedHeader [3] in HexChars)))
  878.           then begin
  879.             IntList^.AddKeyword (OriginalTopicName, 0);
  880.             AddStr2Topic (ExtendedHeader,
  881.                           IntList, IntListName, CurInt, CurSubF, CurCat, True);
  882.           end;
  883.  
  884.           FO. IdxTbl. Insert (New (PIndexEntry, Init (
  885.             TopicName, '', 0, Topic, IndexThisTopic)));
  886.           IndexThisTopic := True;
  887.           SectionClosed := True;
  888.         end;
  889.  
  890.         ProcessHdr (Str);
  891.  
  892.         if (StUpcase2 (TopicName) <> 'SECTION') then begin
  893.           New (Topic, Init (1, 1));
  894.           SectionStarted := True;
  895.           SectionClosed := False;
  896.           TopicName := MakeCorrectTopicName (TopicName);
  897.           OriginalTopicName := TopicName;
  898.           ExtendedHeader := #2 + TopicName + #2;
  899.           Write (TopicName: 31, ' mem - ', MaxAvail: 8, #13);
  900.         end else
  901.           SectionStarted := False;
  902.       end else begin
  903.         if SectionStarted then begin
  904.           I := Pos (#9, Str);
  905.           while I > 0 do begin
  906.             Delete (Str, I, 1);
  907.             for J := 7 downto ((I - 1) mod 8) do
  908.               Insert (' ', Str, I);
  909.             I := Pos (#9, Str);
  910.           end;
  911.  
  912.           StrUp := StUpcase2 (Str);
  913.  
  914.           if  (Copy (StrUp, 1, 4) = 'INT ')
  915.           and (StrUp [5] in HexChars) and (StrUp [6] in HexChars)
  916.           and (Pos ('INT', StUpcase2 (FileName)) > 0) then begin
  917.             I := (Pos (StrUp [5], HexCh) - 1)*16 + Pos (StrUp [6], HexCh) - 1;
  918.             IntLists [I]^.AddKeyword (OriginalTopicName, 0);
  919.             ExtendedHeader := #2 + TopicName + #2
  920.                             + Copy (Str, 7, Length (Str) - 6);
  921.             AddStr2Topic (ExtendedHeader,
  922.                           IntLists [I], string (Pointer(@IntNames [I])^), CurInt, CurSubF, CurCat, True);
  923.             if not ExtendedIndex then
  924.               IndexThisTopic := False; {'cause this topic is indexed in INT XX}
  925.           end;
  926.  
  927.           if  (Copy (StrUp, 1, 5) = 'CMOS ')
  928.           and (StrUp [6] in HexChars) and (StrUp [7] in HexChars)
  929.           and (StrUp [8] = 'H') then begin
  930.             if  (StrUp [9] = '-')
  931.             and (StrUp [10] in HexChars) and (StrUp [11] in HexChars)
  932.             and (StrUp [12] = 'H') then
  933.               ExtendedHeader := Copy (Str, 13, Length (Str) - 12)
  934.             else
  935.               ExtendedHeader := Copy (Str, 9, Length (Str) - 8);
  936.  
  937.             ExtendedHeader := #2 + TopicName + #2 + ExtendedHeader;
  938.           end;
  939.  
  940.           if  (Copy (StrUp, 1, 5) = 'CALL ')
  941.           and (StrUp [6] in HexChars + ['X']) and (StrUp [7] in HexChars + ['X'])
  942.           and (StrUp [8] in HexChars + ['X']) and (StrUp [9] in HexChars + ['X'])
  943.           and (StrUp [10] = 'H')
  944.           and (StrUp [11] = ':')
  945.           and (StrUp [12] in HexChars + ['X']) and (StrUp [13] in HexChars + ['X'])
  946.           and (StrUp [14] in HexChars + ['X']) and (StrUp [15] in HexChars + ['X'])
  947.           and (StrUp [16] = 'H')
  948.           then begin
  949.             ExtendedHeader := #2 + TopicName + #2
  950.                             + Copy (Str, 17, Length (Str) - 16);
  951.           end;
  952.  
  953.           if  (Copy (StrUp, 1, 4) = 'MEM ')
  954.           and (StrUp [5] in HexChars + ['X']) and (StrUp [6] in HexChars + ['X'])
  955.           and (StrUp [7] in HexChars + ['X']) and (StrUp [8] in HexChars + ['X'])
  956.           then
  957.             if  (StrUp [9] = 'H')
  958.             and (StrUp [10] = ':')
  959.             and (StrUp [11] in HexChars + ['X']) and (StrUp [12] in HexChars + ['X'])
  960.             and (StrUp [13] in HexChars + ['X']) and (StrUp [14] in HexChars + ['X'])
  961.             and (StrUp [15] = 'H')
  962.             then
  963.               ExtendedHeader := #2 + TopicName + #2
  964.                               + Copy (Str, 16, Length (Str) - 15)
  965.             else
  966.             if  (StrUp  [9] in HexChars + ['X']) and (StrUp [10] in HexChars + ['X'])
  967.             and (StrUp [11] in HexChars + ['X']) and (StrUp [12] in HexChars + ['X'])
  968.             and (StrUp [13] = 'H')
  969.             then
  970.               ExtendedHeader := #2 + TopicName + #2
  971.                               + Copy (Str, 14, Length (Str) - 13);
  972.  
  973.           if  (Copy (StrUp, 1, 5) = 'PORT ')
  974.           and (StrUp [6] in HexChars) and (StrUp [7] in HexChars)
  975.           and (StrUp [8] in HexChars) and (StrUp [9] in HexChars)
  976.           then begin
  977.             if  (StrUp [10] = '-')
  978.             and (StrUp [11] in HexChars + ['?']) and (StrUp [12] in HexChars + ['?'])
  979.             and (StrUp [13] in HexChars + ['?']) and (StrUp [14] in HexChars + ['?', 'x', ' '])
  980.             then
  981.               ExtendedHeader := Copy (Str, 15, Length (Str) - 14)
  982.             else
  983.               ExtendedHeader := Copy (Str, 10, Length (Str) - 9);
  984.  
  985.             ExtendedHeader := #2 + TopicName + #2 + ExtendedHeader;
  986.           end;
  987.  
  988.           if KeyNames. Count > 0 then
  989.             for I := 0 to KeyNames. Count - 1 do begin
  990.               J := Pos (StUpcase2 (PString32 (KeyNames. At (I))^), StrUp);
  991.               if  (J > 0)
  992.               and ((PTopic (KeyLists. At (I))^. Count = 0)
  993.                 or (PString (PTopic (KeyLists. At (I))^. At (
  994.                     PTopic (KeyLists. At (I))^. Count - 1))^
  995.                  <> ' ' + ExtendedHeader))
  996.               then begin
  997.                 PTopic (KeyLists. Items^ [I])^.AddKeyword (OriginalTopicName, 0);
  998.                 AddStr2Topic (ExtendedHeader,
  999.                               PTopic (KeyLists. Items^ [I]),
  1000.                               PString (KeyNames. At (I))^, CurInt, CurSubF, CurCat, True);
  1001.               end;
  1002.             end;
  1003.  
  1004.           I := Pos ('TABLE', StrUp);
  1005.           if  (I > 0) and (I + 9 <= Length (Str))
  1006.           and (Str [I + 6] in ['0'..'9', 'C', 'F', 'M', 'P'])
  1007.           and (Str [I + 7] in ['0'..'9'])
  1008.           and (Str [I + 8] in ['0'..'9'])
  1009.           and (Str [I + 9] in ['0'..'9'])
  1010.           then begin
  1011.             if not TblClosed then begin
  1012.               PrevStr := TblTopic^.At (TblTopic^.Count - 1);
  1013.               if (PrevStr <> nil) and (PrevStr^ <> '') and (PrevStr^ <> ' ') then begin
  1014.                 TblTopic^. AtDelete (TblTopic^.Count - 1);
  1015.                 if PrevStr <> nil then begin
  1016.                   J := Pos (#2, PrevStr^);
  1017.                   while J > 0 do begin
  1018.                     SavePtr := PrevStr;
  1019.                     PrevStr := NewStr (Copy (PrevStr^, 1, J - 1)
  1020.                                + Copy (PrevStr^, J + 1, Length (PrevStr^) - J));
  1021.                     DisposeStr (SavePtr);
  1022.                     J := Pos (#2, PrevStr^);
  1023.                     if J = 0 then
  1024.                       WriteLn ('error 5');
  1025.                     SavePtr := PrevStr;
  1026.                     PrevStr := NewStr (Copy (PrevStr^, 1, J - 1)
  1027.                                + Copy (PrevStr^, J + 1, Length (PrevStr^) - J));
  1028.                     DisposeStr (SavePtr);
  1029.                     TblTopic^. Keywords. AtFree (TblTopic^. Keywords. Count - 1);
  1030.                     J := Pos (#2, PrevStr^);
  1031.                   end;
  1032.                 end;
  1033.               end else
  1034.                 PrevStr := nil;
  1035.  
  1036.               TblTopic^.AddKeyword (OriginalTopicName, 0);
  1037.               AddStr2Topic (ExtendedHeader, TblTopic, TblTopicName, CurInt, CurSubF, CurCat, False);
  1038.               FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1039.                 TblTopicName, '', 0, TblTopic, False)));
  1040.               TblStarted := False;
  1041.               TblClosed := True;
  1042.             end else begin
  1043.               PrevStr := Topic^.At (Topic^.Count - 1);
  1044.               if (PrevStr <> nil) and (PrevStr^ <> '') and (PrevStr^ <> ' ') then begin
  1045.                 Topic^. AtDelete (Topic^.Count - 1);
  1046.                 if PrevStr <> nil then begin
  1047.                   J := Pos (#2, PrevStr^);
  1048.                   while J > 0 do begin
  1049.                     SavePtr := PrevStr;
  1050.                     PrevStr := NewStr (Copy (PrevStr^, 1, J - 1)
  1051.                                + Copy (PrevStr^, J + 1, Length (PrevStr^) - J));
  1052.                     DisposeStr (SavePtr);
  1053.                     J := Pos (#2, PrevStr^);
  1054.                     if J = 0 then
  1055.                       WriteLn ('error 5');
  1056.                     SavePtr := PrevStr;
  1057.                     PrevStr := NewStr (Copy (PrevStr^, 1, J - 1)
  1058.                                + Copy (PrevStr^, J + 1, Length (PrevStr^) - J));
  1059.                     DisposeStr (SavePtr);
  1060.                     Topic^. Keywords. AtFree (Topic^. Keywords. Count - 1);
  1061.                     J := Pos (#2, PrevStr^);
  1062.                   end;
  1063.                 end;
  1064.               end else
  1065.                 PrevStr := nil;
  1066.             end;
  1067.  
  1068.             New (TblTopic, Init (1, 1));
  1069.             TblStarted := True;
  1070.             TblClosed := False;
  1071.             TblTopicName := MakeCorrectTopicName ('#' + Copy (Str, I + 6, 4));
  1072.  
  1073.             if (PrevStr <> nil) and (PrevStr^ <> '') and (PrevStr^ <> ' ')
  1074.             then begin
  1075.               if Pos (#2, PrevStr^) > 0 then begin
  1076.                 WriteLn (PrevStr^);
  1077.                 WriteLn ('error 4');
  1078.               end;
  1079.               AddStr2Topic (PrevStr^, TblTopic, TblTopicName, CurInt, CurSubF, CurCat, False);
  1080.  
  1081.               AddStr2Topic (TblTopicName + PrevStr^, Topic, TopicName, CurInt, CurSubF, CurCat, True);
  1082.               Tables^.AddKeyword (TopicName, 0);
  1083.               AddStr2Topic (TblTopicName + ' '#2 + TopicName + #2
  1084.                           + PrevStr^, Tables, TablesName, CurInt, CurSubF, CurCat, True);
  1085.             end else
  1086.               AddNextStringToTopicAsATblRef := True;
  1087.             DisposeStr (PrevStr);
  1088.  
  1089.             AddStr2Topic (Str, TblTopic, TblTopicName, CurInt, CurSubF, CurCat, False);
  1090.           end else begin
  1091.             if TblStarted then begin
  1092.               if AddNextStringToTopicAsATblRef then begin
  1093.                 AddStr2Topic (TblTopicName + ' ' + Str, Topic, TopicName, CurInt, CurSubF, CurCat, True);
  1094.                 Tables^.AddKeyword (TopicName, 0);
  1095.                 AddStr2Topic (TblTopicName + ' '#2 + TopicName + #2
  1096.                             + ' ' + Str, Tables, TablesName, CurInt, CurSubF, CurCat, True);
  1097.                 AddNextStringToTopicAsATblRef := False;
  1098.               end;
  1099.  
  1100.               AddStr2Topic (Str, TblTopic, TblTopicName, CurInt, CurSubF, CurCat, False);
  1101.             end;
  1102.           end;
  1103.  
  1104.           if not TblStarted then
  1105.             AddStr2Topic (Str, Topic, TopicName, CurInt, CurSubF, CurCat, True);
  1106.         end;
  1107.       end;
  1108.     end;
  1109.  
  1110.     if not TblClosed then begin
  1111.       TblTopic^.AddKeyword (OriginalTopicName, 0);
  1112.       AddStr2Topic (ExtendedHeader, TblTopic, TblTopicName, CurInt, CurSubF, CurCat, False);
  1113.       FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1114.         TblTopicName, '', 0, TblTopic, False)));
  1115.       TblStarted := False;
  1116.       TblClosed := True;
  1117.     end;
  1118.  
  1119.     if not SectionClosed then begin
  1120.       if Pos ('CMOS', StUpcase2 (FileName)) > 0 then begin
  1121.         CMOS^.AddKeyword (OriginalTopicName, 0);
  1122.         AddStr2Topic (ExtendedHeader,
  1123.                       CMOS, CMOSName, CurInt, CurSubF, CurCat, True);
  1124.       end else
  1125.       if Pos ('FARCALL', StUpcase2 (FileName)) > 0 then begin
  1126.         FarCall^.AddKeyword (OriginalTopicName, 0);
  1127.         AddStr2Topic (ExtendedHeader,
  1128.                       FarCall, FarCallName, CurInt, CurSubF, CurCat, True);
  1129.       end else
  1130.       if Pos ('MEMORY', StUpcase2 (FileName)) > 0 then begin
  1131.         Memory^.AddKeyword (OriginalTopicName, 0);
  1132.         AddStr2Topic (ExtendedHeader,
  1133.                       Memory, MemoryName, CurInt, CurSubF, CurCat, True);
  1134.       end else
  1135.       if Pos ('PORTS', StUpcase2 (FileName)) > 0 then begin
  1136.         Ports^.AddKeyword (OriginalTopicName, 0);
  1137.         AddStr2Topic (ExtendedHeader,
  1138.                       Ports, PortsName, CurInt, CurSubF, CurCat, True);
  1139.       end else
  1140.       if  (FileIsATopic = '')
  1141.       and ((not (ExtendedHeader [2] in HexChars))
  1142.         or (not (ExtendedHeader [3] in HexChars)))
  1143.       then begin
  1144.         IntList^.AddKeyword (OriginalTopicName, 0);
  1145.         AddStr2Topic (ExtendedHeader,
  1146.                       IntList, IntListName, CurInt, CurSubF, CurCat, True);
  1147.       end;
  1148.  
  1149.       FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1150.         TopicName, '', 0, Topic, IndexThisTopic)));
  1151.       IndexThisTopic := True;
  1152.       SectionClosed := True;
  1153.     end;
  1154.  
  1155.     Close (FI);
  1156.   end else
  1157.     ProcessInterrup := False;
  1158. end;
  1159.  
  1160. var
  1161.   Param: string;
  1162.   C: Char;
  1163.   T: PTopic;
  1164.   I: Integer;
  1165.   KeyFile: Text;
  1166.   KeyStr: string;
  1167.   PKeyStr: PString32;
  1168.  
  1169.   SwapFileSize: Longint;
  1170.  
  1171.   F: file;
  1172.  
  1173. begin
  1174.   WriteLn;
  1175.   WriteLn ('=== Int2TPH Interrupt List Compiler v0.9 Copyright (C) 1996 Slava Gostrenko ===');
  1176.   WriteLn;
  1177.  
  1178.   for I := 1 to ParamCount do begin
  1179.     Param := StUpcase2 (ParamStr (I));
  1180.     if Param [1] in ['/', '\', '-'] then
  1181.       if Pos ('SHORTINDEX', Param) = 2 then
  1182.         ExtendedIndex := False
  1183.       else
  1184.       if Param [2] in ['?', 'H'] then begin
  1185.         WriteLn ('Converts Ralf Brown''s Interrupt List into Borland Turbo Help File (.TPH).');
  1186.         WriteLn;
  1187.         WriteLn ('Usage:   Int2TPH [options]');
  1188.         WriteLn ('Options: /ShortIndex  -  generate a shorter index to make it possible');
  1189.         WriteLn ('         to use the resulting help file with the Turbo Help resident.');
  1190.         Exit;
  1191.       end;
  1192.   end;
  1193.  
  1194.   SwapFileSize := Longint (4096)*1024 - MemAvail;
  1195.   if SwapFileSize > 0 then
  1196.     SwapFileSize := SwapFileSize and (-1024)
  1197.   else
  1198.     SwapFileSize := 0;
  1199.   if SwapFileSize > 0 then begin
  1200.     MemInitSwapFile ('int2tph.swp', SwapFileSize);
  1201.     WriteLn ('swap file size - ', SwapFileSize);
  1202.   end;
  1203.  
  1204.   New (SwapFile, Init ('topics.swp', stCreate, 2048));
  1205.  
  1206.   Hdrs. Init (256, 256);
  1207.  
  1208.   FO. Init ('inter.tph', stCreate, 32768);
  1209.   Assign (IncompPattern, 'incomplt.log');
  1210.   Rewrite (IncompPattern);
  1211.  
  1212.   New (T, Init (1, 1));
  1213.   T^. AddString ('The first topic will be never seen');
  1214.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1215.       '', '', 0, T, False)));
  1216.  
  1217.   New (T, Init (16, 16));
  1218.   T^. AddString ('Visit the home page of Slava Gostrenko at http://sunny.aha.ru/~gw/');
  1219.   T^. AddString (' ');
  1220.   T^. AddString ('There you may check for the latest versions of Int2TPH and other software.');
  1221.   T^. AddString (' ');
  1222.   T^. AddString ('=== ARVID AUDIO ===');
  1223.   T^. AddString (' ');
  1224.   T^. AddString ('is a CD quality digital audio tape recorder made of Sound Blaster sound card');
  1225.   T^. AddString ('and  Arvid  streamer  board.  Arvid is a PC board priced at as little as $70');
  1226.   T^. AddString ('that  makes  a  streamer  of your home video tape recorder. It is capable of');
  1227.   T^. AddString ('storing  2  GigaBytes of data on a single tape. With the help of Arvid Audio');
  1228.   T^. AddString ('software you may record 3 hours of digital audio sound on a regular 180 min.');
  1229.   T^. AddString ('videotape.  Arvid  Audio  records from all audio sources available on(via) a');
  1230.   T^. AddString ('Sound Blaster sound card, e.i. CD player, Microphone, Line In. And now it is');
  1231.   T^. AddString ('capable  of  Direct  Digital Recording From CD! Download it now and you will');
  1232.   T^. AddString ('get 3 hours of 44.1 kHz 16 bit stereo sound on a $2 videotape! Visit my home');
  1233.   T^. AddString ('page for more info and references.');
  1234.   T^. AddString (' ');
  1235.   T^. AddString ('=== CD2WAV ===');
  1236.   T^. AddString (' ');
  1237.   T^. AddString ('is  a  CD-DA  (Digital  Audio)  grabber  with  an advanced jitter correction');
  1238.   T^. AddString ('algorithm.');
  1239.   T^. AddString (' ');
  1240.   T^. AddString ('=== BORLAND PASCAL AUTO CORRECTOR ===');
  1241.   T^. AddString (' ');
  1242.   T^. AddString ('is  a  program  that  makes  it much easier to edit your programs in Borland');
  1243.   T^. AddString ('Pascal''s  IDE. Using expandable dictionary BP Auto Corrector beautifies your');
  1244.   T^. AddString ('sources  on  the fly. Type "tmysuperobject" and look at the screen. You will');
  1245.   T^. AddString ('see "TMySuperObject". And you do not have to press shift keys to type such a');
  1246.   T^. AddString ('nice  identifiers.  AutoSave  feature  will unglue your hands from <F2> key.');
  1247.   T^. AddString ('VideoSubst  feature  will enable Borland Pascal''s IDE to work in video modes');
  1248.   T^. AddString ('others  than 80x25 and 80x50. Now you may set up your BP to work in any text');
  1249.   T^. AddString ('video  mode  that  is  supported  by your video card. You may use VESA video');
  1250.   T^. AddString ('modes  too  and enjoy modes with the resolution up to 132x60! Auto Corrector');
  1251.   T^. AddString ('includes  patches  for BP to make a real full screen editor with no menu and');
  1252.   T^. AddString ('status  lines. It means 2 more lines will be used for displaying your source');
  1253.   T^. AddString ('texts. BP Auto Corrector is distributed with source texts!');
  1254.   T^. AddString (' ');
  1255.   T^. AddString ('=== TICKTOSS ===');
  1256.   T^. AddString (' ');
  1257.   T^. AddString ('is a fileechoprocessor for end-user fidonet systems. TickToss is just a .bat');
  1258.   T^. AddString ('file.  No  .exe''s  or  .com''s.  But it has all the features an end-user ever');
  1259.   T^. AddString ('needs. Automatic creation of new fileechoes with meaningful directory names.');
  1260.   T^. AddString ('Creating  and  updating of area configuration file. Creating and updating of');
  1261.   T^. AddString ('files.bbs''s  in  your  fileecho  areas.  Support  for  long  multilined file');
  1262.   T^. AddString ('descriptions. Logging of performed actions. And all the abovelisted features');
  1263.   T^. AddString ('are implemented as a single .bat file. TickToss requires 4dos or compaitable');
  1264.   T^. AddString ('command processor.');
  1265.   T^. AddString (' ');
  1266.   T^. AddString ('=== And MORE... ===');
  1267.   T^. AddString (' ');
  1268.   T^. AddString ('Visit my homepage NOW! ;-)');
  1269.   T^. AddString (' ');
  1270.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1271.       'http://sunny.aha.ru/~gw/', '', 0, T, True)));
  1272.  
  1273.   for I := Low (IntLists) to High (IntLists) do begin
  1274.     New (IntLists [I], Init (16, 16));
  1275.     IntNames [I] := MakeCorrectTopicName ('INT ' + HexByte (I));
  1276.   end;
  1277.  
  1278.   New (IntListIndex, Init (16, 16));
  1279.   IntListIndexName := MakeCorrectTopicName (' INTERRUPT LIST INDEX ');
  1280.   IntListIndex^.AddString (' ===    This help file was compiled with    ===');
  1281.   IntListIndex^.AddString (' === Int2TPH v0.9 (C) 1996 Slava Gostrenko. ===');
  1282.   IntListIndex^.AddKeyword ('http://sunny.aha.ru/~gw/', 0);
  1283.   IntListIndex^.AddString (' === '#2'http://sunny.aha.ru/~gw/'#2' or gw@aha.ru, ===');
  1284.   IntListIndex^.AddString (' === FidoNet 2:5020/201.105,2:5020/468.105. ===');
  1285.   IntListIndex^.AddString (' ');
  1286.   IntListIndex^.AddKeyword ('TITLES', 0);
  1287.   IntListIndex^.AddString (' '#2'Interrupts'#2);
  1288.  
  1289.   KeyLists. Init (1, 1);
  1290.   KeyNames. Init (1, 1);
  1291.   Assign (KeyFile, 'int_keys.txt');
  1292.   {$I-}
  1293.   Reset (KeyFile);
  1294.   {$I+}
  1295.   if IOResult = 0 then begin
  1296.     while not EOF (KeyFile) do begin
  1297.       ReadLn (KeyFile, KeyStr);
  1298.       if Length (KeyStr) > High (PKeyStr^) then
  1299.         WriteLn ('long key - ', KeyStr)
  1300.       else
  1301.         if KeyStr <> '' then begin
  1302.           KeyLists. AtInsert (KeyLists. Count, New (PTopic, Init (1, 1)));
  1303.           New (PKeyStr);
  1304.           PKeyStr^ := MakeCorrectTopicName (KeyStr);
  1305.           KeyNames. AtInsert (KeyNames. Count, PKeyStr);
  1306.  
  1307.           IntListIndex^.AddKeyword (PKeyStr^, 0);
  1308.           IntListIndex^.AddString (' '#2 + PKeyStr^ + #2);
  1309.         end;
  1310.     end;
  1311.  
  1312.     Close (KeyFile);
  1313.   end;
  1314.  
  1315.   New (IntList, Init (16, 16));
  1316.   IntListName := MakeCorrectTopicName ('Interrupt List Misc. Stuff');
  1317.   IntListIndex^.AddKeyword (IntListName, 0);
  1318.   IntListIndex^.AddString (' '#2 + IntListName + #2);
  1319.  
  1320.   New (Tables, Init (16, 16));
  1321.   TablesName := MakeCorrectTopicName ('Tables');
  1322.   IntListIndex^.AddKeyword (TablesName, 0);
  1323.   IntListIndex^.AddString (' '#2 + TablesName + #2);
  1324.  
  1325.   New (CMOS, Init (16, 16));
  1326.   CMOSName := MakeCorrectTopicName ('CMOS');
  1327.   IntListIndex^.AddKeyword (CMOSName, 0);
  1328.   IntListIndex^.AddString (' '#2 + CMOSName + #2);
  1329.  
  1330.   New (FarCall, Init (16, 16));
  1331.   FarCallName := MakeCorrectTopicName ('Far Calls');
  1332.   IntListIndex^.AddKeyword (FarCallName, 0);
  1333.   IntListIndex^.AddString (' '#2 + FarCallName + #2);
  1334.  
  1335.   New (Memory, Init (16, 16));
  1336.   MemoryName := MakeCorrectTopicName ('Memory');
  1337.   IntListIndex^.AddKeyword (MemoryName, 0);
  1338.   IntListIndex^.AddString (' '#2 + MemoryName + #2);
  1339.  
  1340.   New (Ports, Init (16, 16));
  1341.   PortSName := MakeCorrectTopicName ('Ports');
  1342.   IntListIndex^.AddKeyword (PortsName, 0);
  1343.   IntListIndex^.AddString (' '#2 + PortsName + #2);
  1344.  
  1345.   ProcessInterrup ('interrup.1st', '');
  1346.   ProcessInterrup ('category.key', '');
  1347.   ProcessInterRUp ('86bugs.lst', '86 Bugs');
  1348.   IntListIndex^.AddKeyword ('86 Bugs', 0);
  1349.   IntListIndex^.AddString (' '#2'86 Bugs'#2);
  1350.   ProcessInterrup ('biblio.lst', '');
  1351.   ProcessInterrup ('cmos.lst', '');
  1352.   ProcessInterrup ('farcall.lst', '');
  1353.   ProcessInterrup ('glossary.lst', 'Glossary of The Interrupt List');
  1354.   IntListIndex^.AddKeyword ('Glossary of The Interrupt List', 0);
  1355.   IntListIndex^.AddString (' '#2'Glossary of The Interrupt List'#2);
  1356.   ProcessInterrup ('memory.lst', '');
  1357.   ProcessInterrup ('opcodes.lst', 'Opcodes List');
  1358.   IntListIndex^.AddKeyword ('Opcodes List', 0);
  1359.   IntListIndex^.AddString (' '#2'Opcodes List'#2);
  1360.   ProcessInterrup ('overview.lst', '');
  1361.   ProcessInterrup ('ports.lst', '');
  1362.   ProcessInterrup ('tables.lst', '');
  1363.   ProcessInterrup ('interrup.pri', 'Interrupt Primer');
  1364.   IntListIndex^.AddKeyword ('Interrupt Primer', 0);
  1365.   IntListIndex^.AddString (' '#2'Interrupt Primer'#2);
  1366.   ProcessInterrup ('rbrown.txt', 'Ralf Brown');
  1367.   IntListIndex^.AddKeyword ('Ralf Brown', 0);
  1368.   IntListIndex^.AddString (' '#2'Ralf Brown'#2);
  1369.  
  1370.   if not ProcessInterrup ('interrup.lst', '') then
  1371.     for C := 'a' to 'z' do
  1372.       if not ProcessInterrup ('interrup.' + C, '') then
  1373.         Break;
  1374.  
  1375.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1376.     PortsName, '', 0, Ports, True)));
  1377.  
  1378.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1379.     MemoryName, '', 0, Memory, True)));
  1380.  
  1381.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1382.     FarCallName, '', 0, FarCall, True)));
  1383.  
  1384.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1385.     CMOSName, '', 0, CMOS, True)));
  1386.  
  1387.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1388.     TablesName, '', 0, Tables, True)));
  1389.  
  1390.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1391.     IntListName, '', 0, IntList, True)));
  1392.  
  1393.   if KeyLists. Count > 0 then
  1394.     for I := 0 to KeyLists. Count - 1 do
  1395.       FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1396.         PString32 (KeyNames. At (I))^, '', 0, PTopic (KeyLists. Items^ [I]), True)));
  1397.  
  1398.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1399.     IntListIndexName, '', 0, IntListIndex, True)));
  1400.  
  1401.   for I := Low (IntLists) to High (IntLists) do
  1402.     FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1403.       IntNames [I], '', 0, IntLists [I], True)));
  1404.  
  1405.   Close (IncompPattern);
  1406.   FO. Done;
  1407.  
  1408.   WriteLn (Hdrs. Count, ' topics processed.');
  1409.   Hdrs. Done;
  1410.  
  1411.   SwapFile^.Seek (0);
  1412.   SwapFile^.Truncate;
  1413.   Dispose (SwapFile, Done);
  1414.   Assign (F, 'topics.swp');
  1415.   Erase (F);
  1416.  
  1417.   if SwapFileSize > 0 then
  1418.     MemCloseSwapFile (1);
  1419. end.
  1420.